package com.etc.traval.util;

import java.net.URL;
import java.net.URLConnection;
import java.sql.Date;
import java.sql.Timestamp;


public class MyUtil {
	public static Timestamp getWebsiteDatetime(){
        try {
        	String webUrl = "http://www.baidu.com";//获得百度的北京时间
            URL url = new URL(webUrl);// 取得资源对象
            URLConnection uc = url.openConnection();// 生成连接对象
            uc.connect();// 发出连接
          long ld = uc.getDate();// 读取网站日期时间      
          Date date =new Date(ld);
         Timestamp ts=new Timestamp(ld);
            return ts;
        }catch (Exception e) {
            e.printStackTrace();
        }
        return (Timestamp) null;
    }
}
